<%-- 
  - Author: Mohtisham Anwar
  - Date: 31-Mar-2011
  - Copyright Notice: TRAKHEES
  - Description: form.jsp
 --%>

<%@ include file="/WEB-INF/view/include.jsp"%>
<%@ page import="ae.pcfc.etks.online.web.*"%>
<script type="text/javascript">
	$()
			.ready(
					function() {

						//$( "input:submit, input:reset, input:button, input:file").button();

						$("#PersonRegister")
								.validate(
										{
											onfocusout : false,
											onkeyup : false,
											//onclick: false,			
											rules : {

												strClientPersonNameENG : "required",
												strClientPersonNameARB : "required",
												strMobileNo : "required",
												strUserName : "required",
												strPassword : {
													required : true,
													minlength : 8,
													maxlength : 12
												},
												strConfirmPassword : {
													required : true,
													equalTo : "#strPassword"
												},
												iSecQuestion : "required",
												strSecretAnswer : "required",
												strEmailAddress : "required",
												strUploadDocumentType : "required"
											},
											showErrors : function(errorMap,
													errorList) {

												var errors = '<ul>';
												var label;
												if (errorList.length) {
													$.each(errorMap, function(
															name, value) {
														label = $(
																"label[for='"
																		+ name
																		+ "']")
																.html();
														label = value + '['
																+ label + ']';
														errors = errors
																+ '<li>'
																+ label
																+ '</li>';

													});
													errors = errors + '</ul>';
													jAlert('error', errors,
															'<spring:message code="label.errormessage" />');
												}
											}

										});

					});
</script>

<div id="container" dir='<spring:message code="page.dir"/>'
	align='<spring:message code="page.align"/>'>

	<form:form name="PersonRegister" id="PersonRegister" method="POST"
		enctype="multipart/form-data"
		modelAttribute="<%=ConstantsAdmin.CLIENT_PERSON_REGISTER_REQUEST_MODEL_KEY %>">


		<spring:hasBindErrors
			name="<%=ConstantsAdmin.CLIENT_PERSON_REGISTER_REQUEST_MODEL_KEY %>">
			<script type="text/javascript">
				$(document)
						.ready(
								function() {
									jAlert(
											'error',
											'<li><form:errors path="*" delimiter="<li>"/>',
											'<spring:message code="label.errormessage" />');
								});
			</script>
		</spring:hasBindErrors>

		<%
			if (request.getAttribute(ConstantsAdmin.SUCCESS_PARAM) != null) {
		%>
		<h4>
			<spring:message code="success.nonclient.person.upload.documents" />
		</h4>
		<%
			}
		%>
		<div class="ui-widget_c ui-corner-all">
			<div
				class="ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix">
				<spring:message code="label.client.summary.info" />
			</div>
			<div class="ui-widget_content_c t_fin-black-txt">

				<fieldset>
					<legend>
						<spring:message
							code="label.nonclient.person.register.personal.details" />
					</legend>
				</fieldset>
				<div class="t_form-left">
					<div class="fm-req">
						<label> <spring:message
								code="label.nonclient.person.register.nameENG" /> </label>
						<input
						disabled="disabled"
						value='<c:out value="${clientPersonSummary.strNameENG}"></c:out>'>
						<br />
					</div>
					<div class="fm-req">
						<label> <spring:message
								code="label.nonclient.person.register.nameARB" /> </label>
						<input
						disabled="disabled"
						value='<c:out value="${clientPersonSummary.strNameARB}"></c:out>'>
						<br />
					</div>
					<div>
						<label> <spring:message
								code="label.nonclient.person.register.telNoHome" /> </label>
						<input
						disabled="disabled"
						value='<c:out value="${clientPersonSummary.strHomeTel}"></c:out>'>
						<br />
					</div>
					<div class="fm-req">
						<label> <spring:message code="label.company.role" /> </label>
						<select multiple="multiple" style="float: none;height: 75px;" disabled="disabled" class="fm-opt">
						<c:forEach items="${clientPersonSummary.SCClientPersonRoleVO}"
							var="clientRole" varStatus="loop">
							<c:if test="${loop.index > 0 }">
								<c:out value=""></c:out>
							</c:if>
							<c:choose>
								<c:when
									test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
									<option><c:out value="${clientRole.clientRoleArb}"></c:out></option>
								</c:when>
								<c:otherwise>
									<option><c:out value="${clientRole.clientRoleEng}"></c:out></option>
								</c:otherwise>
							</c:choose>
						</c:forEach>
						</select>
						<br />
					</div>
					<div class="fm-req">
						<label> <spring:message
								code="label.nonclient.person.register.mobNo1" /> </label>
						<input
						disabled="disabled"
						value='<c:out value="${clientPersonSummary.strMobile1}"></c:out>'>
						<br />
					</div>

					<div>
						<label> <spring:message
								code="label.nonclient.person.register.emailAddress" /> </label>
						<input
						disabled="disabled"
						value='<c:out value="${clientPersonSummary.strEmail}"></c:out>'>
						<br />
					</div>

					<div>
						<label> <spring:message
								code="label.nonclient.person.register.websiteURL" /> </label>
						<input
						disabled="disabled"
						value='<c:out value="${clientPersonSummary.strWebsite}"></c:out>'>
						<br />
					</div>
				</div>

				<fieldset>
					<legend>
						<spring:message code="label.login.details" />
					</legend>
				</fieldset>

				<div class="t_form-left">
					<div class="fm-req">
						<form:label path="strClientPersonNameENG">
						<span class="t_star">*</span>
							<spring:message code="label.adminname.eng" />
						</form:label>
						<form:input path="strClientPersonNameENG"
							id="strClientPersonNameENG" size="20" maxlength="100" />
					</div>
					<div class="fm-req">
						<form:label path="strClientPersonNameARB">
						<span class="t_star">*</span>
							<spring:message code="label.adminname.arab" />
						</form:label>
						<form:input path="strClientPersonNameARB"
							id="strClientPersonNameARB" size="20" maxlength="100" />
					</div>
					<div class="fm-req">
						<form:label path="strUserName">
						<span class="t_star">*</span>
							<spring:message code="label.client.person.register.user.name" />
						</form:label>
						<form:input path="strUserName" id="strUserName" size="20"
							maxlength="100" />
					</div>
					<div class="fm-req">
						<form:label path="strPassword">
						<span class="t_star">*</span>
							<spring:message code="label.client.person.register.password" />
						</form:label>
						<form:password path="strPassword" id="strPassword" size="20"
							maxlength="100" />
					</div>
					<div class="fm-req">
						<form:label path="strConfirmPassword">
						<span class="t_star">*</span>
							<spring:message
								code="label.client.person.register.confirmPassword" />
						</form:label>
						<form:password path="strConfirmPassword" id="strConfirmPassword"
							size="20" maxlength="100" />
					</div>
					<div class="fm-req">


						<form:label path="iSecQuestion">
						<span class="t_star">*</span>
							<spring:message code="label.secretquestion" />
						</form:label>
						<c:choose>
							<c:when
								test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
								<form:select path="iSecQuestion" items="${userSecretQuestion}"
									id="iSecQuestion" itemLabel="labelAr" itemValue="id"
									class="fm-opt"/>
							</c:when>
							<c:otherwise>
								<form:select path="iSecQuestion" items="${userSecretQuestion}"
									id="iSecQuestion" itemLabel="labelEn" itemValue="id"
									class="fm-opt"/>
							</c:otherwise>
						</c:choose>

					</div>
					<div class="fm-req">
						<form:label path="strSecretAnswer">
						<span class="t_star">*</span>
							<spring:message code="label.client.person.register.secretAnswer" />
						</form:label>
						<form:input path="strSecretAnswer" id="strSecretAnswer" size="20"
							maxlength="100" />
					</div>

					<div class="fm-req">
						<form:label path="strEmailAddress">
						<span class="t_star">*</span>
							<spring:message code="label.client.person.register.emailAddress" />
						</form:label>
						<form:input path="strEmailAddress" id="strEmailAddress" size="20"
							maxlength="100" />
					</div>

					<div class="fm-req">
						<form:label path="strMobileNo">
						<span class="t_star">*</span>
							<spring:message code="label.client.person.register.mobNo" />
						</form:label>
						<form:input path="strMobileNo" id="strMobileNo" size="20"
							maxlength="100" />
					</div>
					<div style="display:none;">
						<form:label path="strMobileNotification">
							<spring:message code="label.client.person.register.notifications" />
						</form:label>
						<div class="fm-multi">
							<spring:message code="label.emailnotification" />
							<form:hidden path="strEmailNotification" value="Y"
								id="strEmailNotification" class="opt-input"/>
							<spring:message code="label.smsnotification" />
							<form:checkbox path="strMobileNotification" value="Y"
								id="strMobileNotification" class="opt-input"/>
						</div>
					</div>
				</div>

				<fieldset>

					<legend>
						<spring:message code="label.company.uploaddocuments" />
					</legend>
				</fieldset>
				<br/>
				<div class="t_form-left">
					<div class="fm-req">
						<div style="clear:both;"></div>
						<form:label path="strUploadDocumentType">
						<span class="t_star">*</span>
							<spring:message code="label.company.uploaddocumentstype" />
						</form:label>
						<c:choose>
							<c:when
								test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
								<form:select path="strUploadDocumentType"
									items="${personClientRegistrationUploadDocumentType}"
									id="strUploadDocumentType" itemLabel="labelAr"
									itemValue="labelAr" cssStyle="width:200px;" class="fm-opt"/>
							</c:when>
							<c:otherwise>
								<form:select path="strUploadDocumentType"
									items="${personClientRegistrationUploadDocumentType}"
									id="strUploadDocumentType" itemLabel="labelEn"
									itemValue="labelEn" cssStyle="width:200px;" class="fm-opt"/>
							</c:otherwise>
						</c:choose>

					</div>

					<form:hidden path="strUploadURL" id="strUploadURL" />
					<form:hidden path="strUploadDocName" id="strUploadDocName" />

					<div class="fm-req">
						<input type="file" id="files[0]" name="files[0]" size="60"
							style="width: 100%" />
					</div>
					<!-- <input type="submit" name="Upload" value="Upload" /> -->

					<form:hidden path="strUploadURL" />

					<div id="fm-submit" class="fm-req">
							<input
							type="submit" name="submit"
							value="<spring:message code="label.button.submit" />" class="t_btns submit"/>
						<input type="reset" name="reset"
							value="<spring:message code="label.button.reset" />" class="t_btns reset"/> 
					</div>
				</div>
			</div>
		</div>



	</form:form>
</div>